import { QuestionCollection } from "inquirer";
import { readFileByType } from "../utils/util";

const newsList: any[] = readFileByType('zentao.task.list', 'json')
const choices = newsList.map((m: any) => (m.title))
const questions: QuestionCollection = [
  {
    type: 'checkbox',
    message: 'Select news',
    name: 'taskList',
    choices: choices,
    validate: function (answer) {
      if (answer.length < 1) {
        return 'You must choose at least one news.';
      }
      return true;
    },
  },
];

export { questions };
